
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include "InputWindow.h"

using namespace std;

#ifdef _WIN32
#include <windows.h>

int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	InputWindow win(400,500,"GNU Exterior Ballistics Computer (Windows)");
	if (lpCmdLine && *lpCmdLine) {
		if (*lpCmdLine == '"') {
		    char *c=lpCmdLine;
			c++;
			while (*c && *c!='"') c++;
			if (c>lpCmdLine && *c == '"') {
				*c='\0';
				lpCmdLine++;
			}
		}
		win.OpenFile(lpCmdLine);
	}
	return Fl::run();
}

#else

int main (int argc, char *argv[])
{
   InputWindow win(400,500,"GNU Exterior Ballistics Computer");
   if (argc==2) {
      win.OpenFile(argv[1]);
      }
   return Fl::run();
}
#endif
